#include <stdio.h>
#include <tgmath.h>
int main()
{
	int a = 24;
	int b = 18;
	int i = 0;
	while (i = a % b)
	{
		a = b;
		b = i;
	}
	printf("%d", b);
	return 0;
}